import Vue from 'vue'
import Vuex from 'vuex'
import createPersist from 'vuex-persistedstate'

Vue.use(Vuex)

export default new Vuex.Store({
  state: {
    token: ''
  },
  plugins: [
    createPersist({
      reducer(val) {
        return {
          token: val.token
        }
      }
    })
  ],
  mutations: {
    saveToken(state,val) {
      state.token = val
    }
  },
  actions: {
  },
  modules: {
  }
})
